<?php

namespace app\admin\model;

use think\Model;

class Informations extends Model {
    public $str;
    public $sqlstr;
    public function index($where)
    {
//       var_dump($where);die;
        if(empty($where)){
           $this->str='%%';
        }else{
            $this->str=$where;
        }
        $cate_info=$this->table('op_informations')
            ->alias('i')
            ->field('i.*, b.catename')
            ->where('i.title','like','%'.$where.'%')
            ->join('op_infocate b','b.id = i.cateid')
            ->order('sort asc')
            ->select();
        return $cate_info;
    }

    public function read($id)
    {

        $cate_info=self::table('op_informations')
            ->alias('i')
            ->field('i.*, b.catename,b.id as cid')
            ->join('op_infocate b','b.id = i.cateid')
            ->where('i.id','=', $id)
            ->select();

        return $cate_info;
    }


}